package org.example.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author 莫磊
 * @date 2025/8/11
 * @description
 */
@Slf4j
@ControllerAdvice
public class ExceptionController {

	@ExceptionHandler
	public String handleArithmeticException(Exception e, Model model) {
		log.error("ArithmeticException: {}", e.getMessage());
		model.addAttribute("errorMsg", e.getMessage());
		return "error";
	}
}
